package com.xlink.service.impl;

import com.xlink.dto.Sensor;
import com.xlink.repository.SensorRepository;
import com.xlink.service.SensorService;
import org.moon.base.service.AbstractService;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
//实现类   调用仓储类  在action中实现
/**
 * Created by asus1 on 2015/12/6.
 */
@Service
public class SensorServiceImpl extends AbstractService implements SensorService {
    @Resource
    private SensorRepository sensorRepository;
    @Override    //查看传感器列表
    public List<Map<String, Object>> list(Map<String, Object> params) {return sensorRepository.list(params);}
    @Override   //查看单个传感器
    public Map<String,Object> get(Long sensorId){return sensorRepository.get(sensorId);}
    @Override     //增加传感器
    public Long add(Sensor sensor) {sensorRepository.add(sensor);return sensor.getId();}
    @Override     //修改传感器
     public boolean update(Map<String, Object> params) { return sensorRepository.update(params)>0; }
    @Override     //删除传感器
    public boolean delete(Long sensorId) { return sensorRepository.delete(sensorId)>0; }

}
